<template>
  <view class="organic-products">
    <view class="header">
      <text class="title">有机农产品</text>
      <text class="view-all">查看全部 ></text>
    </view>
    <view class="product-list">
      <view class="main-product" style="background-color: #f8f8f8;border-radius: 12rpx;">
        <image :src="items[0].image" mode="aspectFill"></image>
        <view class="tag">高原农夫</view>
        <view class="product-info">
          <text class="name">{{ items[0].text }}</text>
          <text class="price">¥{{ items[0].price }}</text>
        </view>
      </view>
      <view class="side-products">
        <view class="product" v-for="(item, index) in items.slice(1)" :key="index">
          <image :src="item.image" mode="aspectFill" style="border-radius: 12px;background-color: #f8f8f8;"></image>
          <view class="product-info">
            <text class="name">{{ item.text }}</text>
            <text class="price">¥{{ item.price }}</text>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      items: [
        { image: 'https://safood.supplyocta.com/Uploads/tempImage/2024-08-19/66c2b0eb6955e4183.png', text: '有机黑枸杞', price: '1798.00' },
        { image: 'https://safood.supplyocta.com/Uploads/tempImage/2024-08-19/66c2b0eb6955e4183.png', text: '冻干银松茸', price: '798.00' },
        { image: 'https://safood.supplyocta.com/Uploads/tempImage/2024-08-19/66c2b0eb6955e4183.png', text: '红枸杞', price: '198.00' }
      ]
    };
  }
};
</script>

<style lang="scss" scoped>
.organic-products {
  padding: 20rpx;
  background-color: #fff;
  border-radius: 20rpx;
  
  .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20rpx;
    
    .title {
      font-size: 32rpx;
      font-weight: bold;
    }
    
    .view-all {
      font-size: 24rpx;
      color: #999;
    }
  }
  
  .product-list {
    display: flex;
    gap: 20rpx;
    height: 400rpx;
    position: relative;
    
    .main-product {
      flex: 3;
    //   background-color: #f8f8f8;
      border-radius: 12rpx;
      image {
        width: 100%;
        height: 100%;
        border-radius: 12rpx;
        object-fit: cover;
      }
      
      .tag {
        position: absolute;
        top: 20rpx;
        left: 20rpx;
        padding: 4rpx 8rpx;
        background-color: #ff6b00;
        color: #fff;
        font-size: 20rpx;
        border-radius: 4rpx;
      }
      
      .product-info {
        position: absolute;
		bottom: -20px;
        left: 20rpx;
        transform: translateY(-50%);
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        
        .name {
          font-size: 28rpx;
          color: #fff;
          text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
          margin-bottom: 12rpx;
        }
        
        .price {
          font-size: 32rpx;
          color: #ff6b00;
          font-weight: bold;
          background-color: rgba(255, 255, 255, 0.8);
          padding: 4rpx 8rpx;
          border-radius: 4rpx;
        }
      }
    }
    
    .side-products {
    //   flex: 2;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      
      .product {
        height: 190rpx;
        display: flex;
        // background-color: #f8f8f8;
        border-radius: 12rpx;
        overflow: hidden;
        
        image {
          width: 190rpx;
          height: 190rpx;
          object-fit: cover;
        }
        
        .product-info {
          flex: 1;
          padding: 20rpx;
          display: flex;
          flex-direction: column;
        //   justify-content: center;
          
          .name {
            font-size: 24rpx;
            margin-bottom: 24rpx;
          }
          
          .price {
            font-size: 28rpx;
            color: #ff6b00;
            font-weight: bold;
          }
        }
      }
    }
  }
}
</style>
